\(\int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx\) [1197]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 25, antiderivative size = 215 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx=-\left (\left (6 a^2 b c d-2 b^3 c d-a^3 \left (c^2-d^2\right )+3 a b^2 \left (c^2-d^2\right )\right ) x\right )-\frac {\left (2 a^3 c d-6 a b^2 c d+3 a^2 b \left (c^2-d^2\right )-b^3 \left (c^2-d^2\right )\right ) \log (\cos (e+f x))}{f}+\frac {2 b (b c+a d) (a c-b d) \tan (e+f x)}{f}+\frac {\left (2 a c d+b \left (c^2-d^2\right )\right ) (a+b \tan (e+f x))^2}{2 f}+\frac {2 c d (a+b \tan (e+f x))^3}{3 f}+\frac {d^2 (a+b \tan (e+f x))^4}{4 b f} \]

[Out]

-(6*a^2*b*c*d-2*b^3*c*d-a^3*(c^2-d^2)+3*a*b^2*(c^2-d^2))*x-(2*a^3*c*d-6*a*b^2*c*d+3*a^2*b*(c^2-d^2)-b^3*(c^2-d
^2))*ln(cos(f*x+e))/f+2*b*(a*d+b*c)*(a*c-b*d)*tan(f*x+e)/f+1/2*(2*a*c*d+b*(c^2-d^2))*(a+b*tan(f*x+e))^2/f+2/3*
c*d*(a+b*tan(f*x+e))^3/f+1/4*d^2*(a+b*tan(f*x+e))^4/b/f

Rubi [A] (verified)

Time = 0.31 (sec) , antiderivative size = 215, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.160, Rules used = {3624, 3609, 3606, 3556} \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx=-\frac {\left (2 a^3 c d+3 a^2 b \left (c^2-d^2\right )-6 a b^2 c d-b^3 \left (c^2-d^2\right )\right ) \log (\cos (e+f x))}{f}-x \left (-\left (a^3 \left (c^2-d^2\right )\right )+6 a^2 b c d+3 a b^2 \left (c^2-d^2\right )-2 b^3 c d\right )+\frac {\left (2 a c d+b \left (c^2-d^2\right )\right ) (a+b \tan (e+f x))^2}{2 f}+\frac {2 c d (a+b \tan (e+f x))^3}{3 f}+\frac {2 b (a d+b c) (a c-b d) \tan (e+f x)}{f}+\frac {d^2 (a+b \tan (e+f x))^4}{4 b f} \]

[In]

Int[(a + b*Tan[e + f*x])^3*(c + d*Tan[e + f*x])^2,x]

[Out]

-((6*a^2*b*c*d - 2*b^3*c*d - a^3*(c^2 - d^2) + 3*a*b^2*(c^2 - d^2))*x) - ((2*a^3*c*d - 6*a*b^2*c*d + 3*a^2*b*(
c^2 - d^2) - b^3*(c^2 - d^2))*Log[Cos[e + f*x]])/f + (2*b*(b*c + a*d)*(a*c - b*d)*Tan[e + f*x])/f + ((2*a*c*d
+ b*(c^2 - d^2))*(a + b*Tan[e + f*x])^2)/(2*f) + (2*c*d*(a + b*Tan[e + f*x])^3)/(3*f) + (d^2*(a + b*Tan[e + f*
x])^4)/(4*b*f)

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3606

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[b*d*(Tan[e + f*x]/f), x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3609

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*
((a + b*Tan[e + f*x])^m/(f*m)), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]

Rule 3624

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2, x_Symbol] :> Simp[
d^2*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Simp[c^2 - d^2 + 2*c*d*Tan[e
 + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ[m, -1] &&  !(EqQ[m, 2] && EqQ
[a, 0])

Rubi steps \begin{align*} \text {integral}& = \frac {d^2 (a+b \tan (e+f x))^4}{4 b f}+\int (a+b \tan (e+f x))^3 \left (c^2-d^2+2 c d \tan (e+f x)\right ) \, dx \\ & = \frac {2 c d (a+b \tan (e+f x))^3}{3 f}+\frac {d^2 (a+b \tan (e+f x))^4}{4 b f}+\int (a+b \tan (e+f x))^2 \left (-2 b c d+a \left (c^2-d^2\right )+\left (2 a c d+b \left (c^2-d^2\right )\right ) \tan (e+f x)\right ) \, dx \\ & = \frac {\left (2 a c d+b \left (c^2-d^2\right )\right ) (a+b \tan (e+f x))^2}{2 f}+\frac {2 c d (a+b \tan (e+f x))^3}{3 f}+\frac {d^2 (a+b \tan (e+f x))^4}{4 b f}+\int (a+b \tan (e+f x)) ((a c-b c-a d-b d) (a c+b c+a d-b d)+2 (b c+a d) (a c-b d) \tan (e+f x)) \, dx \\ & = -\left (\left (6 a^2 b c d-2 b^3 c d-a^3 \left (c^2-d^2\right )+3 a b^2 \left (c^2-d^2\right )\right ) x\right )+\frac {2 b (b c+a d) (a c-b d) \tan (e+f x)}{f}+\frac {\left (2 a c d+b \left (c^2-d^2\right )\right ) (a+b \tan (e+f x))^2}{2 f}+\frac {2 c d (a+b \tan (e+f x))^3}{3 f}+\frac {d^2 (a+b \tan (e+f x))^4}{4 b f}+\left (2 a^3 c d-6 a b^2 c d+3 a^2 b \left (c^2-d^2\right )-b^3 \left (c^2-d^2\right )\right ) \int \tan (e+f x) \, dx \\ & = -\left (\left (6 a^2 b c d-2 b^3 c d-a^3 \left (c^2-d^2\right )+3 a b^2 \left (c^2-d^2\right )\right ) x\right )-\frac {\left (2 a^3 c d-6 a b^2 c d+3 a^2 b \left (c^2-d^2\right )-b^3 \left (c^2-d^2\right )\right ) \log (\cos (e+f x))}{f}+\frac {2 b (b c+a d) (a c-b d) \tan (e+f x)}{f}+\frac {\left (2 a c d+b \left (c^2-d^2\right )\right ) (a+b \tan (e+f x))^2}{2 f}+\frac {2 c d (a+b \tan (e+f x))^3}{3 f}+\frac {d^2 (a+b \tan (e+f x))^4}{4 b f} \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 2.61 (sec) , antiderivative size = 221, normalized size of antiderivative = 1.03 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx=\frac {3 d^2 (a+b \tan (e+f x))^4-6 \left (2 a c d+b \left (-c^2+d^2\right )\right ) \left ((i a-b)^3 \log (i-\tan (e+f x))-(i a+b)^3 \log (i+\tan (e+f x))+6 a b^2 \tan (e+f x)+b^3 \tan ^2(e+f x)\right )-4 c d \left (3 i (a+i b)^4 \log (i-\tan (e+f x))-3 i (a-i b)^4 \log (i+\tan (e+f x))+6 b^2 \left (-6 a^2+b^2\right ) \tan (e+f x)-12 a b^3 \tan ^2(e+f x)-2 b^4 \tan ^3(e+f x)\right )}{12 b f} \]

[In]

Integrate[(a + b*Tan[e + f*x])^3*(c + d*Tan[e + f*x])^2,x]

[Out]

(3*d^2*(a + b*Tan[e + f*x])^4 - 6*(2*a*c*d + b*(-c^2 + d^2))*((I*a - b)^3*Log[I - Tan[e + f*x]] - (I*a + b)^3*
Log[I + Tan[e + f*x]] + 6*a*b^2*Tan[e + f*x] + b^3*Tan[e + f*x]^2) - 4*c*d*((3*I)*(a + I*b)^4*Log[I - Tan[e +
f*x]] - (3*I)*(a - I*b)^4*Log[I + Tan[e + f*x]] + 6*b^2*(-6*a^2 + b^2)*Tan[e + f*x] - 12*a*b^3*Tan[e + f*x]^2
- 2*b^4*Tan[e + f*x]^3))/(12*b*f)

Maple [A] (verified)

Time = 0.27 (sec) , antiderivative size = 232, normalized size of antiderivative = 1.08

method result size
parts \(a^{3} c^{2} x +\frac {\left (3 a \,b^{2} d^{2}+2 b^{3} c d \right ) \left (\frac {\left (\tan ^{3}\left (f x +e \right )\right )}{3}-\tan \left (f x +e \right )+\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {\left (2 a^{3} c d +3 a^{2} b \,c^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {\left (3 a^{2} b \,d^{2}+6 a \,b^{2} c d +b^{3} c^{2}\right ) \left (\frac {\left (\tan ^{2}\left (f x +e \right )\right )}{2}-\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}\right )}{f}+\frac {\left (a^{3} d^{2}+6 a^{2} b c d +3 a \,b^{2} c^{2}\right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {b^{3} d^{2} \left (\frac {\left (\tan ^{4}\left (f x +e \right )\right )}{4}-\frac {\left (\tan ^{2}\left (f x +e \right )\right )}{2}+\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}\right )}{f}\) \(232\)
norman \(\left (a^{3} c^{2}-a^{3} d^{2}-6 a^{2} b c d -3 a \,b^{2} c^{2}+3 a \,b^{2} d^{2}+2 b^{3} c d \right ) x +\frac {\left (a^{3} d^{2}+6 a^{2} b c d +3 a \,b^{2} c^{2}-3 a \,b^{2} d^{2}-2 b^{3} c d \right ) \tan \left (f x +e \right )}{f}+\frac {b \left (3 a^{2} d^{2}+6 a b c d +b^{2} c^{2}-b^{2} d^{2}\right ) \left (\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {b^{3} d^{2} \left (\tan ^{4}\left (f x +e \right )\right )}{4 f}+\frac {b^{2} d \left (3 a d +2 b c \right ) \left (\tan ^{3}\left (f x +e \right )\right )}{3 f}+\frac {\left (2 a^{3} c d +3 a^{2} b \,c^{2}-3 a^{2} b \,d^{2}-6 a \,b^{2} c d -b^{3} c^{2}+b^{3} d^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f}\) \(258\)
derivativedivides \(\frac {\frac {b^{3} d^{2} \left (\tan ^{4}\left (f x +e \right )\right )}{4}+a \,b^{2} d^{2} \left (\tan ^{3}\left (f x +e \right )\right )+\frac {2 b^{3} c d \left (\tan ^{3}\left (f x +e \right )\right )}{3}+\frac {3 a^{2} b \,d^{2} \left (\tan ^{2}\left (f x +e \right )\right )}{2}+3 a \,b^{2} c d \left (\tan ^{2}\left (f x +e \right )\right )+\frac {b^{3} c^{2} \left (\tan ^{2}\left (f x +e \right )\right )}{2}-\frac {b^{3} d^{2} \left (\tan ^{2}\left (f x +e \right )\right )}{2}+a^{3} d^{2} \tan \left (f x +e \right )+6 a^{2} b c d \tan \left (f x +e \right )+3 a \,b^{2} c^{2} \tan \left (f x +e \right )-3 a \,b^{2} d^{2} \tan \left (f x +e \right )-2 b^{3} c d \tan \left (f x +e \right )+\frac {\left (2 a^{3} c d +3 a^{2} b \,c^{2}-3 a^{2} b \,d^{2}-6 a \,b^{2} c d -b^{3} c^{2}+b^{3} d^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{3} c^{2}-a^{3} d^{2}-6 a^{2} b c d -3 a \,b^{2} c^{2}+3 a \,b^{2} d^{2}+2 b^{3} c d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) \(307\)
default \(\frac {\frac {b^{3} d^{2} \left (\tan ^{4}\left (f x +e \right )\right )}{4}+a \,b^{2} d^{2} \left (\tan ^{3}\left (f x +e \right )\right )+\frac {2 b^{3} c d \left (\tan ^{3}\left (f x +e \right )\right )}{3}+\frac {3 a^{2} b \,d^{2} \left (\tan ^{2}\left (f x +e \right )\right )}{2}+3 a \,b^{2} c d \left (\tan ^{2}\left (f x +e \right )\right )+\frac {b^{3} c^{2} \left (\tan ^{2}\left (f x +e \right )\right )}{2}-\frac {b^{3} d^{2} \left (\tan ^{2}\left (f x +e \right )\right )}{2}+a^{3} d^{2} \tan \left (f x +e \right )+6 a^{2} b c d \tan \left (f x +e \right )+3 a \,b^{2} c^{2} \tan \left (f x +e \right )-3 a \,b^{2} d^{2} \tan \left (f x +e \right )-2 b^{3} c d \tan \left (f x +e \right )+\frac {\left (2 a^{3} c d +3 a^{2} b \,c^{2}-3 a^{2} b \,d^{2}-6 a \,b^{2} c d -b^{3} c^{2}+b^{3} d^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{3} c^{2}-a^{3} d^{2}-6 a^{2} b c d -3 a \,b^{2} c^{2}+3 a \,b^{2} d^{2}+2 b^{3} c d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) \(307\)
parallelrisch \(\frac {-6 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) b^{3} c^{2}+6 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) b^{3} d^{2}+3 b^{3} d^{2} \left (\tan ^{4}\left (f x +e \right )\right )+6 b^{3} c^{2} \left (\tan ^{2}\left (f x +e \right )\right )-6 b^{3} d^{2} \left (\tan ^{2}\left (f x +e \right )\right )+12 a^{3} d^{2} \tan \left (f x +e \right )+12 a^{3} c^{2} f x -12 a^{3} d^{2} f x +12 a \,b^{2} d^{2} \left (\tan ^{3}\left (f x +e \right )\right )+8 b^{3} c d \left (\tan ^{3}\left (f x +e \right )\right )+18 a^{2} b \,d^{2} \left (\tan ^{2}\left (f x +e \right )\right )+36 a \,b^{2} c^{2} \tan \left (f x +e \right )-36 a \,b^{2} d^{2} \tan \left (f x +e \right )-24 b^{3} c d \tan \left (f x +e \right )+72 a^{2} b c d \tan \left (f x +e \right )+36 a \,b^{2} c d \left (\tan ^{2}\left (f x +e \right )\right )-36 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a \,b^{2} c d -36 a \,b^{2} c^{2} f x +36 a \,b^{2} d^{2} f x +24 b^{3} c d f x +12 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{3} c d +18 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} b \,c^{2}-18 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} b \,d^{2}-72 a^{2} b c d f x}{12 f}\) \(367\)
risch \(a^{3} c^{2} x -a^{3} d^{2} x -\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) b^{3} d^{2}}{f}-i b^{3} c^{2} x -3 a \,b^{2} c^{2} x +3 a \,b^{2} d^{2} x +2 b^{3} c d x +i b^{3} d^{2} x +\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) b^{3} c^{2}}{f}-6 a^{2} b c d x +\frac {6 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a \,b^{2} c d}{f}-6 i a \,b^{2} c d x +\frac {4 i a^{3} c d e}{f}+\frac {6 i a^{2} b \,c^{2} e}{f}-\frac {6 i a^{2} b \,d^{2} e}{f}-\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a^{3} c d}{f}-\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a^{2} b \,c^{2}}{f}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a^{2} b \,d^{2}}{f}+2 i a^{3} c d x +3 i a^{2} b \,c^{2} x -3 i a^{2} b \,d^{2} x +\frac {2 i \left (9 a \,b^{2} c^{2}-12 a \,b^{2} d^{2}-20 b^{3} c d \,{\mathrm e}^{2 i \left (f x +e \right )}+27 a \,b^{2} c^{2} {\mathrm e}^{2 i \left (f x +e \right )}-30 a \,b^{2} d^{2} {\mathrm e}^{2 i \left (f x +e \right )}-36 a \,b^{2} d^{2} {\mathrm e}^{4 i \left (f x +e \right )}-24 b^{3} c d \,{\mathrm e}^{4 i \left (f x +e \right )}-12 b^{3} c d \,{\mathrm e}^{6 i \left (f x +e \right )}+27 a \,b^{2} c^{2} {\mathrm e}^{4 i \left (f x +e \right )}+9 a \,b^{2} c^{2} {\mathrm e}^{6 i \left (f x +e \right )}-18 a \,b^{2} d^{2} {\mathrm e}^{6 i \left (f x +e \right )}+6 i b^{3} d^{2} {\mathrm e}^{2 i \left (f x +e \right )}-3 i b^{3} c^{2} {\mathrm e}^{6 i \left (f x +e \right )}-6 i b^{3} c^{2} {\mathrm e}^{4 i \left (f x +e \right )}+3 a^{3} d^{2}-8 b^{3} c d +18 a^{2} b c d +9 a^{3} d^{2} {\mathrm e}^{2 i \left (f x +e \right )}+3 a^{3} d^{2} {\mathrm e}^{6 i \left (f x +e \right )}+9 a^{3} d^{2} {\mathrm e}^{4 i \left (f x +e \right )}-18 i a \,b^{2} c d \,{\mathrm e}^{2 i \left (f x +e \right )}+18 a^{2} b c d \,{\mathrm e}^{6 i \left (f x +e \right )}+54 a^{2} b c d \,{\mathrm e}^{4 i \left (f x +e \right )}+54 a^{2} b c d \,{\mathrm e}^{2 i \left (f x +e \right )}+6 i b^{3} d^{2} {\mathrm e}^{4 i \left (f x +e \right )}-3 i b^{3} c^{2} {\mathrm e}^{2 i \left (f x +e \right )}+6 i b^{3} d^{2} {\mathrm e}^{6 i \left (f x +e \right )}-9 i a^{2} b \,d^{2} {\mathrm e}^{2 i \left (f x +e \right )}-18 i a^{2} b \,d^{2} {\mathrm e}^{4 i \left (f x +e \right )}-9 i a^{2} b \,d^{2} {\mathrm e}^{6 i \left (f x +e \right )}-36 i a \,b^{2} c d \,{\mathrm e}^{4 i \left (f x +e \right )}-18 i a \,b^{2} c d \,{\mathrm e}^{6 i \left (f x +e \right )}\right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{4}}-\frac {2 i b^{3} c^{2} e}{f}+\frac {2 i b^{3} d^{2} e}{f}-\frac {12 i a \,b^{2} c d e}{f}\) \(872\)

[In]

int((a+b*tan(f*x+e))^3*(c+d*tan(f*x+e))^2,x,method=_RETURNVERBOSE)

[Out]

a^3*c^2*x+(3*a*b^2*d^2+2*b^3*c*d)/f*(1/3*tan(f*x+e)^3-tan(f*x+e)+arctan(tan(f*x+e)))+1/2*(2*a^3*c*d+3*a^2*b*c^
2)/f*ln(1+tan(f*x+e)^2)+(3*a^2*b*d^2+6*a*b^2*c*d+b^3*c^2)/f*(1/2*tan(f*x+e)^2-1/2*ln(1+tan(f*x+e)^2))+(a^3*d^2
+6*a^2*b*c*d+3*a*b^2*c^2)/f*(tan(f*x+e)-arctan(tan(f*x+e)))+b^3*d^2/f*(1/4*tan(f*x+e)^4-1/2*tan(f*x+e)^2+1/2*l
n(1+tan(f*x+e)^2))

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 252, normalized size of antiderivative = 1.17 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx=\frac {3 \, b^{3} d^{2} \tan \left (f x + e\right )^{4} + 4 \, {\left (2 \, b^{3} c d + 3 \, a b^{2} d^{2}\right )} \tan \left (f x + e\right )^{3} + 12 \, {\left ({\left (a^{3} - 3 \, a b^{2}\right )} c^{2} - 2 \, {\left (3 \, a^{2} b - b^{3}\right )} c d - {\left (a^{3} - 3 \, a b^{2}\right )} d^{2}\right )} f x + 6 \, {\left (b^{3} c^{2} + 6 \, a b^{2} c d + {\left (3 \, a^{2} b - b^{3}\right )} d^{2}\right )} \tan \left (f x + e\right )^{2} - 6 \, {\left ({\left (3 \, a^{2} b - b^{3}\right )} c^{2} + 2 \, {\left (a^{3} - 3 \, a b^{2}\right )} c d - {\left (3 \, a^{2} b - b^{3}\right )} d^{2}\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 12 \, {\left (3 \, a b^{2} c^{2} + 2 \, {\left (3 \, a^{2} b - b^{3}\right )} c d + {\left (a^{3} - 3 \, a b^{2}\right )} d^{2}\right )} \tan \left (f x + e\right )}{12 \, f} \]

[In]

integrate((a+b*tan(f*x+e))^3*(c+d*tan(f*x+e))^2,x, algorithm="fricas")

[Out]

1/12*(3*b^3*d^2*tan(f*x + e)^4 + 4*(2*b^3*c*d + 3*a*b^2*d^2)*tan(f*x + e)^3 + 12*((a^3 - 3*a*b^2)*c^2 - 2*(3*a
^2*b - b^3)*c*d - (a^3 - 3*a*b^2)*d^2)*f*x + 6*(b^3*c^2 + 6*a*b^2*c*d + (3*a^2*b - b^3)*d^2)*tan(f*x + e)^2 -
6*((3*a^2*b - b^3)*c^2 + 2*(a^3 - 3*a*b^2)*c*d - (3*a^2*b - b^3)*d^2)*log(1/(tan(f*x + e)^2 + 1)) + 12*(3*a*b^
2*c^2 + 2*(3*a^2*b - b^3)*c*d + (a^3 - 3*a*b^2)*d^2)*tan(f*x + e))/f

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 445 vs. \(2 (190) = 380\).

Time = 0.17 (sec) , antiderivative size = 445, normalized size of antiderivative = 2.07 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx=\begin {cases} a^{3} c^{2} x + \frac {a^{3} c d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} - a^{3} d^{2} x + \frac {a^{3} d^{2} \tan {\left (e + f x \right )}}{f} + \frac {3 a^{2} b c^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - 6 a^{2} b c d x + \frac {6 a^{2} b c d \tan {\left (e + f x \right )}}{f} - \frac {3 a^{2} b d^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {3 a^{2} b d^{2} \tan ^{2}{\left (e + f x \right )}}{2 f} - 3 a b^{2} c^{2} x + \frac {3 a b^{2} c^{2} \tan {\left (e + f x \right )}}{f} - \frac {3 a b^{2} c d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} + \frac {3 a b^{2} c d \tan ^{2}{\left (e + f x \right )}}{f} + 3 a b^{2} d^{2} x + \frac {a b^{2} d^{2} \tan ^{3}{\left (e + f x \right )}}{f} - \frac {3 a b^{2} d^{2} \tan {\left (e + f x \right )}}{f} - \frac {b^{3} c^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {b^{3} c^{2} \tan ^{2}{\left (e + f x \right )}}{2 f} + 2 b^{3} c d x + \frac {2 b^{3} c d \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac {2 b^{3} c d \tan {\left (e + f x \right )}}{f} + \frac {b^{3} d^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {b^{3} d^{2} \tan ^{4}{\left (e + f x \right )}}{4 f} - \frac {b^{3} d^{2} \tan ^{2}{\left (e + f x \right )}}{2 f} & \text {for}\: f \neq 0 \\x \left (a + b \tan {\left (e \right )}\right )^{3} \left (c + d \tan {\left (e \right )}\right )^{2} & \text {otherwise} \end {cases} \]

[In]

integrate((a+b*tan(f*x+e))**3*(c+d*tan(f*x+e))**2,x)

[Out]

Piecewise((a**3*c**2*x + a**3*c*d*log(tan(e + f*x)**2 + 1)/f - a**3*d**2*x + a**3*d**2*tan(e + f*x)/f + 3*a**2
*b*c**2*log(tan(e + f*x)**2 + 1)/(2*f) - 6*a**2*b*c*d*x + 6*a**2*b*c*d*tan(e + f*x)/f - 3*a**2*b*d**2*log(tan(
e + f*x)**2 + 1)/(2*f) + 3*a**2*b*d**2*tan(e + f*x)**2/(2*f) - 3*a*b**2*c**2*x + 3*a*b**2*c**2*tan(e + f*x)/f
- 3*a*b**2*c*d*log(tan(e + f*x)**2 + 1)/f + 3*a*b**2*c*d*tan(e + f*x)**2/f + 3*a*b**2*d**2*x + a*b**2*d**2*tan
(e + f*x)**3/f - 3*a*b**2*d**2*tan(e + f*x)/f - b**3*c**2*log(tan(e + f*x)**2 + 1)/(2*f) + b**3*c**2*tan(e + f
*x)**2/(2*f) + 2*b**3*c*d*x + 2*b**3*c*d*tan(e + f*x)**3/(3*f) - 2*b**3*c*d*tan(e + f*x)/f + b**3*d**2*log(tan
(e + f*x)**2 + 1)/(2*f) + b**3*d**2*tan(e + f*x)**4/(4*f) - b**3*d**2*tan(e + f*x)**2/(2*f), Ne(f, 0)), (x*(a
+ b*tan(e))**3*(c + d*tan(e))**2, True))

Maxima [A] (verification not implemented)

none

Time = 0.63 (sec) , antiderivative size = 253, normalized size of antiderivative = 1.18 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx=\frac {3 \, b^{3} d^{2} \tan \left (f x + e\right )^{4} + 4 \, {\left (2 \, b^{3} c d + 3 \, a b^{2} d^{2}\right )} \tan \left (f x + e\right )^{3} + 6 \, {\left (b^{3} c^{2} + 6 \, a b^{2} c d + {\left (3 \, a^{2} b - b^{3}\right )} d^{2}\right )} \tan \left (f x + e\right )^{2} + 12 \, {\left ({\left (a^{3} - 3 \, a b^{2}\right )} c^{2} - 2 \, {\left (3 \, a^{2} b - b^{3}\right )} c d - {\left (a^{3} - 3 \, a b^{2}\right )} d^{2}\right )} {\left (f x + e\right )} + 6 \, {\left ({\left (3 \, a^{2} b - b^{3}\right )} c^{2} + 2 \, {\left (a^{3} - 3 \, a b^{2}\right )} c d - {\left (3 \, a^{2} b - b^{3}\right )} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 12 \, {\left (3 \, a b^{2} c^{2} + 2 \, {\left (3 \, a^{2} b - b^{3}\right )} c d + {\left (a^{3} - 3 \, a b^{2}\right )} d^{2}\right )} \tan \left (f x + e\right )}{12 \, f} \]

[In]

integrate((a+b*tan(f*x+e))^3*(c+d*tan(f*x+e))^2,x, algorithm="maxima")

[Out]

1/12*(3*b^3*d^2*tan(f*x + e)^4 + 4*(2*b^3*c*d + 3*a*b^2*d^2)*tan(f*x + e)^3 + 6*(b^3*c^2 + 6*a*b^2*c*d + (3*a^
2*b - b^3)*d^2)*tan(f*x + e)^2 + 12*((a^3 - 3*a*b^2)*c^2 - 2*(3*a^2*b - b^3)*c*d - (a^3 - 3*a*b^2)*d^2)*(f*x +
 e) + 6*((3*a^2*b - b^3)*c^2 + 2*(a^3 - 3*a*b^2)*c*d - (3*a^2*b - b^3)*d^2)*log(tan(f*x + e)^2 + 1) + 12*(3*a*
b^2*c^2 + 2*(3*a^2*b - b^3)*c*d + (a^3 - 3*a*b^2)*d^2)*tan(f*x + e))/f

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 3977 vs. \(2 (209) = 418\).

Time = 3.00 (sec) , antiderivative size = 3977, normalized size of antiderivative = 18.50 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx=\text {Too large to display} \]

[In]

integrate((a+b*tan(f*x+e))^3*(c+d*tan(f*x+e))^2,x, algorithm="giac")

[Out]

1/12*(12*a^3*c^2*f*x*tan(f*x)^4*tan(e)^4 - 36*a*b^2*c^2*f*x*tan(f*x)^4*tan(e)^4 - 72*a^2*b*c*d*f*x*tan(f*x)^4*
tan(e)^4 + 24*b^3*c*d*f*x*tan(f*x)^4*tan(e)^4 - 12*a^3*d^2*f*x*tan(f*x)^4*tan(e)^4 + 36*a*b^2*d^2*f*x*tan(f*x)
^4*tan(e)^4 - 18*a^2*b*c^2*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)
^2 + tan(e)^2 + 1))*tan(f*x)^4*tan(e)^4 + 6*b^3*c^2*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f
*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^4*tan(e)^4 - 12*a^3*c*d*log(4*(tan(f*x)^2*tan(e)^2 - 2*t
an(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^4*tan(e)^4 + 36*a*b^2*c*d*log(
4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^4*
tan(e)^4 + 18*a^2*b*d^2*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2
+ tan(e)^2 + 1))*tan(f*x)^4*tan(e)^4 - 6*b^3*d^2*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)
^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^4*tan(e)^4 - 48*a^3*c^2*f*x*tan(f*x)^3*tan(e)^3 + 144*a*b^2
*c^2*f*x*tan(f*x)^3*tan(e)^3 + 288*a^2*b*c*d*f*x*tan(f*x)^3*tan(e)^3 - 96*b^3*c*d*f*x*tan(f*x)^3*tan(e)^3 + 48
*a^3*d^2*f*x*tan(f*x)^3*tan(e)^3 - 144*a*b^2*d^2*f*x*tan(f*x)^3*tan(e)^3 + 6*b^3*c^2*tan(f*x)^4*tan(e)^4 + 36*
a*b^2*c*d*tan(f*x)^4*tan(e)^4 + 18*a^2*b*d^2*tan(f*x)^4*tan(e)^4 - 9*b^3*d^2*tan(f*x)^4*tan(e)^4 + 72*a^2*b*c^
2*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f
*x)^3*tan(e)^3 - 24*b^3*c^2*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x
)^2 + tan(e)^2 + 1))*tan(f*x)^3*tan(e)^3 + 48*a^3*c*d*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan
(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^3*tan(e)^3 - 144*a*b^2*c*d*log(4*(tan(f*x)^2*tan(e)^2
- 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^3*tan(e)^3 - 72*a^2*b*d^2
*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*
x)^3*tan(e)^3 + 24*b^3*d^2*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)
^2 + tan(e)^2 + 1))*tan(f*x)^3*tan(e)^3 - 36*a*b^2*c^2*tan(f*x)^4*tan(e)^3 - 72*a^2*b*c*d*tan(f*x)^4*tan(e)^3
+ 24*b^3*c*d*tan(f*x)^4*tan(e)^3 - 12*a^3*d^2*tan(f*x)^4*tan(e)^3 + 36*a*b^2*d^2*tan(f*x)^4*tan(e)^3 - 36*a*b^
2*c^2*tan(f*x)^3*tan(e)^4 - 72*a^2*b*c*d*tan(f*x)^3*tan(e)^4 + 24*b^3*c*d*tan(f*x)^3*tan(e)^4 - 12*a^3*d^2*tan
(f*x)^3*tan(e)^4 + 36*a*b^2*d^2*tan(f*x)^3*tan(e)^4 + 72*a^3*c^2*f*x*tan(f*x)^2*tan(e)^2 - 216*a*b^2*c^2*f*x*t
an(f*x)^2*tan(e)^2 - 432*a^2*b*c*d*f*x*tan(f*x)^2*tan(e)^2 + 144*b^3*c*d*f*x*tan(f*x)^2*tan(e)^2 - 72*a^3*d^2*
f*x*tan(f*x)^2*tan(e)^2 + 216*a*b^2*d^2*f*x*tan(f*x)^2*tan(e)^2 + 6*b^3*c^2*tan(f*x)^4*tan(e)^2 + 36*a*b^2*c*d
*tan(f*x)^4*tan(e)^2 + 18*a^2*b*d^2*tan(f*x)^4*tan(e)^2 - 6*b^3*d^2*tan(f*x)^4*tan(e)^2 - 12*b^3*c^2*tan(f*x)^
3*tan(e)^3 - 72*a*b^2*c*d*tan(f*x)^3*tan(e)^3 - 36*a^2*b*d^2*tan(f*x)^3*tan(e)^3 + 24*b^3*d^2*tan(f*x)^3*tan(e
)^3 + 6*b^3*c^2*tan(f*x)^2*tan(e)^4 + 36*a*b^2*c*d*tan(f*x)^2*tan(e)^4 + 18*a^2*b*d^2*tan(f*x)^2*tan(e)^4 - 6*
b^3*d^2*tan(f*x)^2*tan(e)^4 - 8*b^3*c*d*tan(f*x)^4*tan(e) - 12*a*b^2*d^2*tan(f*x)^4*tan(e) - 108*a^2*b*c^2*log
(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^2
*tan(e)^2 + 36*b^3*c^2*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 +
 tan(e)^2 + 1))*tan(f*x)^2*tan(e)^2 - 72*a^3*c*d*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)
^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^2*tan(e)^2 + 216*a*b^2*c*d*log(4*(tan(f*x)^2*tan(e)^2 - 2*t
an(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^2*tan(e)^2 + 108*a^2*b*d^2*log
(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^2
*tan(e)^2 - 36*b^3*d^2*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 +
 tan(e)^2 + 1))*tan(f*x)^2*tan(e)^2 + 108*a*b^2*c^2*tan(f*x)^3*tan(e)^2 + 216*a^2*b*c*d*tan(f*x)^3*tan(e)^2 -
96*b^3*c*d*tan(f*x)^3*tan(e)^2 + 36*a^3*d^2*tan(f*x)^3*tan(e)^2 - 144*a*b^2*d^2*tan(f*x)^3*tan(e)^2 + 108*a*b^
2*c^2*tan(f*x)^2*tan(e)^3 + 216*a^2*b*c*d*tan(f*x)^2*tan(e)^3 - 96*b^3*c*d*tan(f*x)^2*tan(e)^3 + 36*a^3*d^2*ta
n(f*x)^2*tan(e)^3 - 144*a*b^2*d^2*tan(f*x)^2*tan(e)^3 - 8*b^3*c*d*tan(f*x)*tan(e)^4 - 12*a*b^2*d^2*tan(f*x)*ta
n(e)^4 + 3*b^3*d^2*tan(f*x)^4 - 48*a^3*c^2*f*x*tan(f*x)*tan(e) + 144*a*b^2*c^2*f*x*tan(f*x)*tan(e) + 288*a^2*b
*c*d*f*x*tan(f*x)*tan(e) - 96*b^3*c*d*f*x*tan(f*x)*tan(e) + 48*a^3*d^2*f*x*tan(f*x)*tan(e) - 144*a*b^2*d^2*f*x
*tan(f*x)*tan(e) - 12*b^3*c^2*tan(f*x)^3*tan(e) - 72*a*b^2*c*d*tan(f*x)^3*tan(e) - 36*a^2*b*d^2*tan(f*x)^3*tan
(e) + 24*b^3*d^2*tan(f*x)^3*tan(e) + 12*b^3*c^2*tan(f*x)^2*tan(e)^2 + 72*a*b^2*c*d*tan(f*x)^2*tan(e)^2 + 36*a^
2*b*d^2*tan(f*x)^2*tan(e)^2 - 12*b^3*d^2*tan(f*x)^2*tan(e)^2 - 12*b^3*c^2*tan(f*x)*tan(e)^3 - 72*a*b^2*c*d*tan
(f*x)*tan(e)^3 - 36*a^2*b*d^2*tan(f*x)*tan(e)^3 + 24*b^3*d^2*tan(f*x)*tan(e)^3 + 3*b^3*d^2*tan(e)^4 + 8*b^3*c*
d*tan(f*x)^3 + 12*a*b^2*d^2*tan(f*x)^3 + 72*a^2*b*c^2*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan
(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)*tan(e) - 24*b^3*c^2*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan
(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)*tan(e) + 48*a^3*c*d*log(4*(tan(f
*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)*tan(e) - 1
44*a*b^2*c*d*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2
+ 1))*tan(f*x)*tan(e) - 72*a^2*b*d^2*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2
+ tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)*tan(e) + 24*b^3*d^2*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)
/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)*tan(e) - 108*a*b^2*c^2*tan(f*x)^2*tan(e) - 216*a^
2*b*c*d*tan(f*x)^2*tan(e) + 96*b^3*c*d*tan(f*x)^2*tan(e) - 36*a^3*d^2*tan(f*x)^2*tan(e) + 144*a*b^2*d^2*tan(f*
x)^2*tan(e) - 108*a*b^2*c^2*tan(f*x)*tan(e)^2 - 216*a^2*b*c*d*tan(f*x)*tan(e)^2 + 96*b^3*c*d*tan(f*x)*tan(e)^2
 - 36*a^3*d^2*tan(f*x)*tan(e)^2 + 144*a*b^2*d^2*tan(f*x)*tan(e)^2 + 8*b^3*c*d*tan(e)^3 + 12*a*b^2*d^2*tan(e)^3
 + 12*a^3*c^2*f*x - 36*a*b^2*c^2*f*x - 72*a^2*b*c*d*f*x + 24*b^3*c*d*f*x - 12*a^3*d^2*f*x + 36*a*b^2*d^2*f*x +
 6*b^3*c^2*tan(f*x)^2 + 36*a*b^2*c*d*tan(f*x)^2 + 18*a^2*b*d^2*tan(f*x)^2 - 6*b^3*d^2*tan(f*x)^2 - 12*b^3*c^2*
tan(f*x)*tan(e) - 72*a*b^2*c*d*tan(f*x)*tan(e) - 36*a^2*b*d^2*tan(f*x)*tan(e) + 24*b^3*d^2*tan(f*x)*tan(e) + 6
*b^3*c^2*tan(e)^2 + 36*a*b^2*c*d*tan(e)^2 + 18*a^2*b*d^2*tan(e)^2 - 6*b^3*d^2*tan(e)^2 - 18*a^2*b*c^2*log(4*(t
an(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1)) + 6*b^3*c^2*log
(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1)) - 12*a^3*c
*d*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1)) + 36
*a*b^2*c*d*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 +
1)) + 18*a^2*b*d^2*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan
(e)^2 + 1)) - 6*b^3*d^2*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2
+ tan(e)^2 + 1)) + 36*a*b^2*c^2*tan(f*x) + 72*a^2*b*c*d*tan(f*x) - 24*b^3*c*d*tan(f*x) + 12*a^3*d^2*tan(f*x) -
 36*a*b^2*d^2*tan(f*x) + 36*a*b^2*c^2*tan(e) + 72*a^2*b*c*d*tan(e) - 24*b^3*c*d*tan(e) + 12*a^3*d^2*tan(e) - 3
6*a*b^2*d^2*tan(e) + 6*b^3*c^2 + 36*a*b^2*c*d + 18*a^2*b*d^2 - 9*b^3*d^2)/(f*tan(f*x)^4*tan(e)^4 - 4*f*tan(f*x
)^3*tan(e)^3 + 6*f*tan(f*x)^2*tan(e)^2 - 4*f*tan(f*x)*tan(e) + f)

Mupad [B] (verification not implemented)

Time = 6.59 (sec) , antiderivative size = 259, normalized size of antiderivative = 1.20 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^2 \, dx=x\,\left (a^3\,c^2-a^3\,d^2-6\,a^2\,b\,c\,d-3\,a\,b^2\,c^2+3\,a\,b^2\,d^2+2\,b^3\,c\,d\right )+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^3\,d^2-b^2\,d\,\left (3\,a\,d+2\,b\,c\right )+3\,a\,b^2\,c^2+6\,a^2\,b\,c\,d\right )}{f}-\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (-a^3\,c\,d-\frac {3\,a^2\,b\,c^2}{2}+\frac {3\,a^2\,b\,d^2}{2}+3\,a\,b^2\,c\,d+\frac {b^3\,c^2}{2}-\frac {b^3\,d^2}{2}\right )}{f}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {3\,a^2\,b\,d^2}{2}+3\,a\,b^2\,c\,d+\frac {b^3\,c^2}{2}-\frac {b^3\,d^2}{2}\right )}{f}+\frac {b^3\,d^2\,{\mathrm {tan}\left (e+f\,x\right )}^4}{4\,f}+\frac {b^2\,d\,{\mathrm {tan}\left (e+f\,x\right )}^3\,\left (3\,a\,d+2\,b\,c\right )}{3\,f} \]

[In]

int((a + b*tan(e + f*x))^3*(c + d*tan(e + f*x))^2,x)

[Out]

x*(a^3*c^2 - a^3*d^2 - 3*a*b^2*c^2 + 3*a*b^2*d^2 + 2*b^3*c*d - 6*a^2*b*c*d) + (tan(e + f*x)*(a^3*d^2 - b^2*d*(
3*a*d + 2*b*c) + 3*a*b^2*c^2 + 6*a^2*b*c*d))/f - (log(tan(e + f*x)^2 + 1)*((b^3*c^2)/2 - (b^3*d^2)/2 - (3*a^2*
b*c^2)/2 + (3*a^2*b*d^2)/2 - a^3*c*d + 3*a*b^2*c*d))/f + (tan(e + f*x)^2*((b^3*c^2)/2 - (b^3*d^2)/2 + (3*a^2*b
*d^2)/2 + 3*a*b^2*c*d))/f + (b^3*d^2*tan(e + f*x)^4)/(4*f) + (b^2*d*tan(e + f*x)^3*(3*a*d + 2*b*c))/(3*f)